cmake_minimum_required(VERSION 3.4.1)
#定义路径变量，如lib_src_DIR = ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}
set(lib_src_DIR ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI})
#设置生成的so动态库最后输出的路径
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${lib_src_DIR})
#第三库使用到的头文件
include_directories(
        ${CMAKE_SOURCE_DIR}/src/main/cpp/include
        )

link_directories(
        lib_src_DIR ${CMAKE_SOURCE_DIR}/src/main/jniLibs/${ANDROID_ABI}
       )

#编解码库
add_library(
            avcodec-57_lib
            SHARED
            IMPORTED)
set_target_properties(
            avcodec-57_lib
            PROPERTIES IMPORTED_LOCATION
            ${lib_src_DIR}/libavcodec-57.so)

#各种设备的输入输出
add_library(
            avdevice-57_lib
            SHARED
            IMPORTED)
set_target_properties(
            avdevice-57_lib
            PROPERTIES IMPORTED_LOCATION
            ${lib_src_DIR}/libavdevice-57.so)

#滤镜特效处理
add_library(
            avfilter-6_lib
            SHARED
            IMPORTED)
set_target_properties(
            avfilter-6_lib
            PROPERTIES IMPORTED_LOCATION
            ${lib_src_DIR}/libavfilter-6.so)

#封装格式处理
add_library(
            avformat-57_lib
            SHARED
            IMPORTED)
set_target_properties(
            avformat-57_lib
            PROPERTIES IMPORTED_LOCATION
            ${lib_src_DIR}/libavformat-57.so)

#工具库
add_library(
            avutil-55_lib
            SHARED
            IMPORTED)
set_target_properties(
            avutil-55_lib
            PROPERTIES IMPORTED_LOCATION
            ${lib_src_DIR}/libavutil-55.so)

#后加工
add_library(
            postproc-54_lib
            SHARED
            IMPORTED)
set_target_properties(
            postproc-54_lib
            PROPERTIES IMPORTED_LOCATION
            ${lib_src_DIR}/libpostproc-54.so)

#音频采样数据格式转换
add_library(
            swresample-2_lib
            SHARED
            IMPORTED)
set_target_properties(
            swresample-2_lib
            PROPERTIES IMPORTED_LOCATION
            ${lib_src_DIR}/libswresample-2.so)

#视频像素数据格式转换
add_library(
            swscale-4_lib
            SHARED
            IMPORTED)
set_target_properties(
            swscale-4_lib
            PROPERTIES IMPORTED_LOCATION
            ${lib_src_DIR}/libswscale-4.so)

#图片压缩
add_library(
            libjpeg
            SHARED
            IMPORTED)
set_target_properties(
            libjpeg
            PROPERTIES IMPORTED_LOCATION
            ${lib_src_DIR}/libjpeg.so)


add_library(
             weiweilib
             SHARED
             src/main/cpp/native-lib.cpp
               src/main/cpp/SplitVideo.cpp)


find_library(
              log-lib
              log )

target_link_libraries(
                       weiweilib
                       avfilter-6_lib
                       avformat-57_lib
                       avcodec-57_lib
                       swresample-2_lib
                       swscale-4_lib
                       avutil-55_lib
                       postproc-54_lib
                       avdevice-57_lib
                       libjpeg
                        -lm -lz
                       ${log-lib} )